package com.example.mynote.base;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;

public abstract class BaseFragment extends Fragment {
    public Context mContext;

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = LayoutInflater.from(getActivity()).inflate(Layout(), null);
        mContext = getActivity();
        initView(view);
        initData();
        return view;
    }

    public void intentTo(Class cla) {
        startActivity(new Intent(getActivity(), cla));
    }

    protected abstract int Layout();

    protected abstract void initView(View v);

    protected abstract void initData();
}
